package generic.utils;

public class PE_Utils {
	public static float bin_dec(Boolean[] bin){
		int dec = 0;
		for (boolean bit : bin) dec = dec * 2 + (bit? 1 : 0);
		return (float) dec;		
	}
	
	public static float log2(float n){
		return (float) (Math.log(n) / Math.log(2));
	}
	
	public static int log2_up(float n){
		return (int) log2(n)+1;
	}
}
